<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>expressões regulares</title>
       
        
    </head>
    <body>
        <h1>Validando expressões regulares</h1>
        <form name="formulario" action="expressaoregular.php" method="post">
            <?php
                if (isset($_POST["regex"])){
                    $result = preg_match($_POST["regex"], $_POST["valor"]);
                    echo "valor do teste:<br/>";
                    var_dump($result);
                    if($result ){
                        echo "<br/>Campo valido!<br/>";
                    }else
                        echo "<br/>Campo invalido!<br/>";
                }
            ?>
            Regex:<input type="text" name="regex" size="50" <?php echo isset($_POST["regex"]) ?  "value='".$_POST["regex"]."'" : "" ?> /><br/>
            Valor:<textarea name="valor"><?php echo isset($_POST["valor"]) ?  $_POST["valor"] : "" ?></textarea> <br/>
            <input type="submit" value="validar"/>
        </form>
    </body>
</html>
